
const semver = require('semver');
const chalk = require('chalk');

const execSync = require('child_process').execSync;

const packageJson = require('../package.json');


export function() {
    const tag = '@latest';
    const processVersion = execSync('npm view @tools/commander-shops version').toString();
    const updateMessage = `你可以执行 npm install -g @tools/commander-shops${tag} 来安装最新版本${processVersion}\n`;
    if (!semver.satisfies(processVersion, packageJson.version)) {
        console.log(chalk.red(updateMessage));
    }
} 
